#!/bin/bash

INPUT_DIR=$1
OUTPUT_DIR=$2

gnuplot << EOF
set title "SLA Violations / CPU Usage"
set xlabel "CPU Usage"
set ylabel "PhP Response Time"
set terminal postscript eps
set output "${OUTPUT_DIR}/slaViolation_cpuUsage.eps"
plot "${INPUT_DIR}/slaViolation_cpuUsage.dat"  using 1:2 with points title "SLA Violation / CPU Usage"
EOF

################# DAS #####################
gnuplot << EOF
set title "SLA Violations / CPU Usage"
set xlabel "CPU Usage"
set ylabel "PhP Response Time"
set terminal postscript eps

set yrange [0:25000]
set xrange [0:100]

set output "${OUTPUT_DIR}/profiling_das3.log_Backend_Cpu_Resp.eps"
plot  "${INPUT_DIR}/profiling_das3.log_Backend_Cpu_Resp.dat"  using 1:2 with points title "SLA Violation / CPU Usage"

set output "${OUTPUT_DIR}/profiling_das4.log_Backend_Cpu_Resp.eps"
plot  "${INPUT_DIR}/profiling_das4.log_Backend_Cpu_Resp.dat"  using 1:2 with points title "SLA Violation / CPU Usage"
EOF


################# EC2 #####################
gnuplot << EOF
set title "SLA Violations / CPU Usage"
set xlabel "CPU Usage"
set ylabel "PhP Response Time"

set yrange [0:25000]
set xrange [0:100]

set terminal postscript eps
set output "${OUTPUT_DIR}/profiling_ec2_h.log_Backend_Cpu_Resp.eps"
plot  "${INPUT_DIR}/profiling_ec2_h.log_Backend_Cpu_Resp.dat"  using 1:2 with points title "SLA Violation / CPU Usage"

set output "${OUTPUT_DIR}/profiling_ec2_hw.log_Backend_Cpu_Resp.eps"
plot  "${INPUT_DIR}/profiling_ec2_hw.log_Backend_Cpu_Resp.dat"  using 1:2 with points title "SLA Violation / CPU Usage"

set output "${OUTPUT_DIR}/profiling_ec2_w.log_Backend_Cpu_Resp.eps"
plot  "${INPUT_DIR}/profiling_ec2_w.log_Backend_Cpu_Resp.dat"  using 1:2 with points title "SLA Violation / CPU Usage"

set output "${OUTPUT_DIR}/profiling_ec2_n.log_Backend_Cpu_Resp.eps"
plot  "${INPUT_DIR}/profiling_ec2_n.log_Backend_Cpu_Resp.dat"  using 1:2 with points title "SLA Violation / CPU Usage"

EOF


################# First #####################
gnuplot << EOF
set title "SLA Violations / CPU Usage"
set xlabel "CPU Usage"
set ylabel "PhP Response Time"
set terminal postscript eps

set yrange [0:25000]
set xrange [0:100]

set output "${OUTPUT_DIR}/profiling.log_Backend_Cpu_Resp.eps"
plot  "${INPUT_DIR}/profiling.log_Backend_Cpu_Resp.dat"  using 1:2 with points title "SLA Violation / CPU Usage"
EOF
